<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>审批历史明细</title>
    <#include "/pubHeadStyle.html">
</head>
<style>
    .layui-layout-body{
        overflow-y: auto;
    }
</style>
<body>
<table class="table-detail">
    <tr>
        <th style="width: 15%">流程运行ID（runId）:</th>
        <td name="runId"></td>
    </tr>
    <tr>
        <th>流程模型ID:</th>
        <td name="modelId"></td>
    </tr>
    <tr>
        <th>流程实例标题:</th>
        <td name="subject"></td>
    </tr>
    <tr>
        <th>创建人ID:</th>
        <td name="creatorId"></td>
    </tr>
    <tr>
        <th>创建人:</th>
        <td name="creator"></td>
    </tr>
    <tr>
        <th>创建时间:</th>
        <td name="createTime"></td>
    </tr>
    <tr>
        <th>业务表单简述:</th>
        <td name="busDescp"></td>
    </tr>
    <tr>
        <th>状态:</th>
        <td name="status"></td>
    </tr>
    <tr>
        <th>流程实例ID:</th>
        <td name="procInstId"></td>
    </tr>
    <tr>
        <th>流程定义ID:</th>
        <td name="procDefId"></td>
    </tr>
    <tr>
        <th>流程业务ID(businessKey):</th>
        <td name="businessKey"></td>
    </tr>
</table>

<script>
    layui.config({
        base: serverPath.systemPath + staticPath.formPath //静态资源所在路径
    }).extend({
        index: 'index' //主入口模块
    }).use(['index','table', 'setter', 'element', 'util'], function () {
        var setter = layui.setter
            , table = layui.table
            , element = layui.element
            , $ = layui.$
            , util = layui.util;
        var runId = "${runId}";

        function getValue(data) {
            return data == null ? "" : data;
        }

        $.ajax({
            url: serverPath.workflowPath + setter.workflowLinkPath + "processRun/detail?runId=" + runId,
            type: "get",
            contentType: 'application/json',
            dataType: 'json',
            success: function (data) {
                var returnData = data.data;

                $("[name='runId']").html("<label>" + getValue(returnData.runId) + "</label>");
                $("[name='modelId']").html("<label>" + getValue(returnData.modelId) + "</label>");
                $("[name='subject']").html("<label>" + getValue(returnData.subject) + "</label>");
                $("[name='creatorId']").html("<label>" + getValue(returnData.creatorId) + "</label>");
                $("[name='creator']").html("<label>" + getValue(returnData.creator) + "</label>");

                var createTime = util.toDateString(returnData.createTime, "yyyy-MM-dd HH:mm:ss");
                $("[name='createTime']").html("<label>" + createTime + "</label>");
                $("[name='busDescp']").html("<label>" + getValue(returnData.busDescp) + "</label>");

                var status = returnData.status;
                if (status === 1) {
                    status = "正在运行";
                } else if (status === 2) {
                    status = "结束";
                } else if (status === 3) {
                    status = "人工结束";
                } else if (status === 4) {
                    status = "流程草稿";
                } else if (status === 5) {
                    status = "已撤销";
                } else if (status === 6) {
                    status = "已驳回";
                } else if (status === 7) {
                    status = "已追回";
                } else if (status === 10) {
                    status = "逻辑删除";
                } else {
                    status = "未知";
                }
                $("[name='status']").html("<label>" + status + "</label>");
                $("[name='procInstId']").html("<label>" + returnData.procInstId + "</label>");
                $("[name='procDefId']").html("<label>" + returnData.procDefId + "</label>");
                $("[name='businessKey']").html("<label>" + returnData.businessKey + "</label>");

            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                layer.alert("暂无数据，请稍后操作！" + XMLHttpRequest.status);
            }
        });
    });
</script>
</body>
</html>